home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / pdox693.zip / TI1107.ASC < prev    next >
Text File  |  1993-03-09  |  8KB  |  331 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Paradox                               NUMBER  :  1107
  9.   VERSION  :  4.0
  10.        OS  :  DOS
  11.      DATE  :  March 9, 1993                            PAGE  :  1/5
  12.  
  13.     TITLE  :  Manipulating Window Frames in Paradox 4.0
  14.  
  15.  
  16.  
  17.  
  18.   Intended Audience:
  19.   This Technical Information sheet is intended for someone with a
  20.   moderate level of PAL 4.0 knowledge and an aptitude for
  21.   experimentation.
  22.  
  23.   Prerequisites:
  24.   A basic understanding of Dynamic Arrays, Events, and the Paradox
  25.   4.0 user interface.
  26.  
  27.   Purpose:
  28.   The purpose of this Technical Information sheet is to give
  29.   instructions for toggling a window frame on or off and a more
  30.   sophisticated technique which automatically removes the frame of
  31.   new windows as they are opened.
  32.  
  33.   It is sometimes desirable to remove the window frame which is
  34.   placed around all Paradox objects.  This removal of the frame
  35.   allows the user to see more of the object on the workspace
  36.   without scrolling.  In addition, the frame is less useful for
  37.   users who do not have or use a mouse.  The first part of this
  38.   document explains how to use the SetKey command to use a hotkey
  39.   toggle which turns the frame on and off.  The second part
  40.   demonstrates the use of a GetEvent loop which analyzes each
  41.   window as it is created and removes its frame automatically.
  42.  
  43.   Part I
  44.  
  45.   Changing a feature or "Attribute" of a window is usually done by
  46.   creating a dynamic array then assigning the attributes defined in
  47.   this array to a window.
  48.  
  49.   The following is a statement which defines a dynamic array that
  50.   can turn off a frame:
  51.  
  52.        DYNARRAY WinAttributes[]
  53.        WinAttributes["HASFRAME"] = False
  54.  
  55.   So far this statement has done nothing more than declare the
  56.   existence of the Dynarray and assign/create a single tag equal to
  57.   the value False.
  58.  
  59.   To actually modify a window with this tool you must use the
  60.   Window Setattributes command.  This command sets attributes from
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  Paradox                               NUMBER  :  1107
  75.   VERSION  :  4.0
  76.        OS  :  DOS
  77.      DATE  :  March 9, 1993                            PAGE  :  2/5
  78.  
  79.     TITLE  :  Manipulating Window Frames in Paradox 4.0
  80.  
  81.  
  82.  
  83.  
  84.   a dynamic array to a specific window identifier called a
  85.   "handle".  The following command turns off the frame for a window
  86.   whose handle is stored in a variable called "WinHandle":
  87.  
  88.        WINDOW SETATTRIBUTES WinHandle FROM WinAttributes
  89.  
  90.   Note: Many other options may be set using this technique.  A
  91.   useful addition to the code above is the ability to Maximize a
  92.   window.  You can do this by assigning the value True to the
  93.   "Maximized" tag.
  94.  
  95.   The three lines of code discussed here could easily be placed
  96.   into a script file and played by using the SetKey command.  The
  97.   following command would play a script called "NoFrame", which
  98.   contains the code listed above, by pressing the hotkey
  99.   combination Alt-F:
  100.  
  101.        SETKEY -33 PLAY "NoFrame"
  102.  
  103.   Here is the contents of NoFrame.Sc up to this point, including
  104.   the Maximized option:
  105.  
  106.        DYNARRAY WinAttributes[]
  107.        WinAttributes["HasFrame"] = False
  108.        WinAttributes["Maximized"] = True
  109.  
  110.        WINDOW SETATTRIBUTES WinHandle FROM WinAttributes
  111.  
  112.   So far we have a script which always assures that the frame is
  113.   off and the window is maximized.  If we wanted to make this a
  114.   true toggle, we would have to analyze the current window
  115.   attributes and switch the frame on or off depending on it's
  116.   current state.  To read the attributes from use the Window
  117.   GetAttributes command.  This command creates a dynamic array
  118.   which holds values for all of the possible window attributes.
  119.   You can use the PAL "Not" operator to switch the True or False
  120.   value to its opposite.
  121.  
  122.   The following script gets the attributes from the current window
  123.   (using a PAL function called GETWINDOW()), toggles the frame
  124.   element of the dynamic array, sets the Maximized option to true
  125.   regardless of current setting, then sets the attributes on the
  126.   current window from the modified dynamic array:
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.   PRODUCT  :  Paradox                               NUMBER  :  1107
  141.   VERSION  :  4.0
  142.        OS  :  DOS
  143.      DATE  :  March 9, 1993                            PAGE  :  3/5
  144.  
  145.     TITLE  :  Manipulating Window Frames in Paradox 4.0
  146.  
  147.  
  148.  
  149.  
  150.        WINDOW GETATTRIBUTES GETWINDOW() TO WinAttributes
  151.        WinAttributes["HASFRAME"] = NOT WinAttributes["HasFrame"]
  152.        WinAttributes["MAXIMIZED"] = True
  153.        WINDOW SETATTRIBUTES GETWINDOW() FROM WinAttributes
  154.  
  155.   You can remove the third line from the script if you do not want
  156.   to expand the window as well as toggle the frame.
  157.  
  158.   Part II
  159.  
  160.   A non-mouse user may wish to always run Paradox interactively
  161.   without frames on any windows created by Paradox.  It is possible
  162.   to run a special loop which allows a user to have full access to
  163.   most features in the interactive program but also checks
  164.   constantly for new window creation.  When a new window appears
  165.   the frame is removed.
  166.  
  167.   A new handle is determined by comparing the last highest value to
  168.   the current window handle.  Paradox assigns incremental numeric
  169.   values to handles as new windows are opened.  The following
  170.   script does just this:
  171.  
  172.   DYNARRAY NoFrame[]
  173.   NoFrame["HASFRAME"] = False
  174.  
  175.   NewHandle = 0
  176.   HighHandle = 0
  177.   ECHO NORMAL
  178.  
  179.   WHILE (True)
  180.     GETEVENT TO NewEvent
  181.     IF NewEvent["TYPE"] = "KEY" AND NewEvent["KEYCODE"] = 17 THEN
  182.         QUITLOOP
  183.     ENDIF
  184.     EXECEVENT NewEvent
  185.     NewHandle = GETWINDOW()
  186.     IF NewHandle > HighHandle THEN
  187.       WINDOW SETATTRIBUTES NewHandle FROM NoFrame
  188.       HighHandle = NewHandle
  189.     ENDIF
  190.   ENDWHILE
  191.    
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.   PRODUCT  :  Paradox                               NUMBER  :  1107
  207.   VERSION  :  4.0
  208.        OS  :  DOS
  209.      DATE  :  March 9, 1993                            PAGE  :  4/5
  210.  
  211.     TITLE  :  Manipulating Window Frames in Paradox 4.0
  212.  
  213.  
  214.  
  215.  
  216.   Briefly, this script does the following:
  217.  
  218.       o  Declares a dynamic array called NoFrame with Frame
  219.          attribute off and Maximized option on.
  220.  
  221.       o  Initializes HighHandle and NewHandle variables.
  222.  
  223.       o  Uses Echo Normal to allow the user to see all activity on
  224.          the interactive workspace.
  225.  
  226.       o  Enters a While loop to recursively perform the processes
  227.          which follow.
  228.  
  229.       o  Gets the next Event (i.e.  mouse action, key action, menu
  230.          choice, etc.).
  231.  
  232.       o  Checks to see if the key combination Ctrl-Q (ASCII code
  233.          17) has been pressed to exit the loop.
  234.  
  235.       o  Executes the event for Paradox processing.
  236.  
  237.       o  Assigns the window handle of the current window to the
  238.          variable NewHandle.
  239.  
  240.       o  If the value of NewHandle is higher than the previous high
  241.          handle (HighHandle), then turn the frame off on the new
  242.          window.
  243.  
  244.       o  Makes the new handle the highest handle for comparison to
  245.          subsequent window handles.
  246.  
  247.   This process will continue until the user leaves Paradox or
  248.   presses Ctrl-Q.
  249.  
  250.   Notes:
  251.  
  252.       o  The Scripts main menu selection will be different while
  253.          running under script control.  If you want to write
  254.          scripts or do instant scripts, you must terminate the
  255.          GetEvent loop with Ctrl-Q.
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.   PRODUCT  :  Paradox                               NUMBER  :  1107
  273.   VERSION  :  4.0
  274.        OS  :  DOS
  275.      DATE  :  March 9, 1993                            PAGE  :  5/5
  276.  
  277.     TITLE  :  Manipulating Window Frames in Paradox 4.0
  278.  
  279.  
  280.  
  281.  
  282.       o  This script may cause slow performance on machines with
  283.          low memory due to the constant code swapping that would be
  284.          necessary to process events.
  285.  
  286.       o  See your PAL Reference Guide for full explanations of the
  287.          PAL commands in the above scripts.
  288.  
  289.   DISCLAIMER: You have the right to use this technical information
  290.   subject to the terms of the No-Nonsense License Statement that
  291.   you received with the Borland product to which this information
  292.   pertains.
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.